package oop4;

import java.util.Scanner;

public class RentSystem {

	public static void main(String[] args) {
		// 汽车租赁系统
		Scanner in = new Scanner(System.in);
		Company SE = new Company();
		Car jiao[] = new Car[6];
		int num2 = 0;
		Bus ke[] = new Bus[6];
		jiao[0] = new Car("京NY28588", "宝马", 800, "X6");
		jiao[1] = new Car("京CNY3284", "宝马", 600, "550i");
		jiao[2] = new Car("京NT37465", "别克", 300, "林荫大道");
		jiao[3] = new Car("京NT96968", "别克", 600, "GL8");
		SE.add(new Car("京NY28588", "宝马", 800, "X6"));
		for (int i = 4; i < jiao.length; i++) {
			jiao[i] = new Car(null, null, 0, null);
		}
		ke[0] = new Bus("京6566754", "金杯", 800, 16);
		ke[1] = new Bus("京6566754", "金龙", 800, 16);
		ke[2] = new Bus("京6566754", "金杯", 1500, 34);
		ke[3] = new Bus("京6566754", "金龙", 1500, 34);
		for (int i = 4; i < jiao.length; i++) {
			ke[i] = new Bus(null, null, 0, 0);
		}
		SE.inTo(jiao);
		SE.inTo(ke);

		while (true) {
			System.out.println("欢迎访问汽车租赁系统！(按0返回上一层)");
			System.out.println("1:新增车辆");
			System.out.println("2:查看车辆信息");
			System.out.println("3:删除淘汰车辆");
			System.out.println("4:接车车辆");
			System.out.println("5:车辆归还");
			System.out.println("6:退出系统");
			int num = in.nextInt();
			switch (num) {
			case 1:
				System.out.println("请输入车牌号");
				String c = in.next();
				System.out.println("请输入品牌");
				String p = in.next();
				System.out.println("请输入租金");
				double z = in.nextDouble();
				System.out.println("如果是轿车请按1，不是请按2");
				int b = in.nextInt();
				if (b == 1) {
					{
						System.out.println("请输入轿车类型");
						String l = in.next();
						SE.add(c, p, z, l);
					}

				} else {
					System.out.println("请输入客车座位数");
					int f = in.nextInt();
					SE.add(c, p, z, f);
				}
				System.out.println("输入完成，请按0返回");
				num2 = in.nextInt();
				while (num2 != 0)
					num2 = in.nextInt();
				break;

			case 2:
				System.out.println("--->查看车辆");
				SE.showInfo();
				num2 = in.nextInt();
				while (num2 != 0)
					num2 = in.nextInt();
				break;
			case 3:
				System.out.println("--->淘汰旧车");
				System.out.println("请输入品牌：");
				p = in.next();
				System.out.println("如果是轿车请按1，不是请按2");
				int x = in.nextInt();
				if (x == 1) {
					{
						System.out.println("请输入轿车类型");
						String l = in.next();
						SE.delete(p, l);
					}

				} else {
					System.out.println("请输入客车座位数");
					int f = in.nextInt();
					SE.delete(p, f);
				}
				System.out.println("删除完成，请按0返回");
				num2 = in.nextInt();
				while (num2 != 0)
					num2 = in.nextInt();
				break;

			case 4:
				System.out.println("--->租车");
				System.out.println("请输入品牌：");
				p = in.next();
				System.out.println("如果是轿车请按1，不是请按2");
				int q = in.nextInt();
				if (q == 1) {
					{
						System.out.println("请输入轿车类型");
						String l = in.next();
						SE.rent(p, l);
					}

				} else {
					System.out.println("请输入客车座位数");
					int m = in.nextInt();
					SE.rent(p, m);
				}
				System.out.println("删除完成，请按0返回");
				num2 = in.nextInt();
				while (num2 != 0)
					num2 = in.nextInt();
				break;
			case 5:
				System.out.println("--->淘汰旧车");
				System.out.println("请输入品牌：");
				p = in.next();
				System.out.println("如果是轿车请按1，不是请按2");
				int o = in.nextInt();
				if (o == 1) {
					{
						System.out.println("请输入轿车类型");
						String l = in.next();
						SE.giveBack(p, l);
					}

				} else {
					System.out.println("请输入客车座位数");
					int f = in.nextInt();
					SE.giveBack(p, f);
				}
				System.out.println("删除完成，请按0返回");
				num2 = in.nextInt();
				while (num2 != 0)
					num2 = in.nextInt();
				break;
			case 6:
				return;
			default:
				System.out.println("输入错误，按任意键返回");
				String a = in.next();
			}

		}
	}

}
